/** 
 * Copyright (C) 2012 Foxit Corporation.
 * All Rights Reserved.
 *
 * The following code is copyrighted and contains proprietary information and trade secrets of Foxit Corporation. 
 * You can only redistribute files listed below to customers of your application, under a written SDK license agreement with Foxit. 
 * You cannot distribute any part of the SDK to general public, even with a SDK license agreement. 
 * Without SDK license agreement, you cannot redistribute anything.
 * @file	fpdffwlevent.h
 * @brief	Extended header file for the Form FWL EVENT module.
 * @details	The content of this header file is an extension of the fwl event module.<br>
 *			In this headfile, we define external event messages(including messages of mouse and keyboard), 
 *			which are defined by this SDK and independent of platforms. 
 *			Applications should send data to methods of this SDK in correct message formats according to definitions in this file.
 *			<br>
 * @note	If you want to purchase Foxit PDF SDK license and use ANY of the following functions, please
 *			request for enabling Form Field module explicitly. 
 * @version 2.0
 */

/** 
 * @addtogroup FGSPDFFWLEVENT PDF Fwlevent
 * @brief Definitions and Methods in this module are included in fpdffwlevent.h.
 */
 
 /** @{*/

#ifndef __FGSPDFFWLEVENT__
#define __FGSPDFFWLEVENT__

#include "../dp/fgsdp.h"


#ifdef __cplusplus
extern "C" {
#endif

/** 
 * @name FGSPDFFWLEVENT Enumeration Types
 */
/**@{*/
/**
 * @brief Enumeration for Event Types.
 */
enum {
    /** The type of the event is mouse. */
    kFWLEventTypeMouse            = 0,
    /** The type of the event is mousewheel. */
    kFWLEventTypeMouseWheel       = 1,
    /** The type of the event is key. */
    kFWLEventTypeKey              = 2,
}; 
/** @brief Alias of enumeration for event types. */
typedef UInt32 FWLEventType;

/**
 * @brief Enumeration for Key Flags.
 */
enum {    
	/** The flag of the event: the "Shift" key. */
    FWLEventKeyFlagShiftKey			= 1 << 0,
	/** The flag of the event: the "Ctrl" key. */
    FWLEventKeyFlagControlKey		= 1 << 1,
	/** The flag of the event: the "Alt" key. */
    FWLEventKeyFlagAltKey			= 1 << 2,
	/** The flag of the event: meta key. */
    FWLEventKeyFlagMetaKey			= 1 << 3,
	/** The flag of the event: key pad. */
    FWLEventKeyFlagKeyPad			= 1 << 4,
	/** The flag of the event: auto repeat. */
    FWLEventKeyFlagAutoRepeat		= 1 << 5,
	/** The flag of the event: the left button of the mouse is down. */
    FWLEventKeyFlagLeftButtonDown	= 1 << 6,	
	/** The flag of the event: the middle button of the mouse is down. */
    FWLEventKeyFlagMiddleButtonDown	= 1 << 7,
	/** The flag of the event: the right button of the mouse is down. */
    FWLEventKeyFlagRightButtonDown	= 1 << 8,	
};
/** @brief Alias of enumeration for event key flags. */
typedef UInt32 FWLEventKeyFlag;
    
/** 
 *@brief Enumeration for Mouse Message Commands
 */
enum {
	/** The mouse command event: the left button of the mouse is down. */
    FWLEventMouseCmdLButtonDown     = 1,	
	/** The mouse command event: the left button of the mouse is up. */
    FWLEventMouseCmdLButtonUp		= 2,	
	/** The mouse command event: the left button of the mouse is double clicked. */
    FWLEventMouseCmdLButtonDblClk	= 3,
	/** The mouse command event: the right button of the mouse is down. */
    FWLEventMouseCmdRButtonDown		= 4,
	/** The mouse command event: the right button of the mouse is up. */
    FWLEventMouseCmdRButtonUp		= 5,
	/** The mouse command event: the right button of the mouse is double clicked. */
    FWLEventMouseCmdRButtonDblClk	= 6,
	/** The mouse command event: the middle button of the mouse is down. */
    FWLEventMouseCmdMButtonDown		= 7,	
	/** The mouse command event: the middle button of the mouse is up. */
    FWLEventMouseCmdMButtonUp		= 8,	
	/** The mouse command event: the middle button of the mouse is double clicked. */
    FWLEventMouseCmdMButtonDblClk	= 9,	
	/** The mouse command event: mouse move. */
    FWLEventMouseCmdMouseMove		= 10,	
	/** The mouse command event: mouse enter. */
    FWLEventMouseCmdMouseEnter		= 11,	
	/** The mouse command event: mouse hover. */
    FWLEventMouseCmdMouseHover		= 12,	
	/** The mouse command event: mouse leave. */
    FWLEventMouseCmdMouseLeave		= 13,	
};
/** @brief Alias of enumeration for mouse message commands. */
typedef UInt32 FWLEventMouseCmd;
/**@}*/
    
/** 
 *@brief Structure for Mouse Event. 
 */
typedef struct __FWLEventMouse
{
	/** The mouse command. See enum definitions of <b>FWLEventMouseCmd</b>. */
    UInt32 command;   
	/** The event flag. See enum definitions of <b>FWLEventKeyFlag</b>. */
    UInt32 flag;	
	/** The value of the x-coordinate of the mouse position. */
    Float32 x;
	/** The value of the y-coordinate of the mouse position. */
    Float32 y;			
} FWLEventMouse;

/** 
 *@brief Structure for Mouse Wheel. 
 */
typedef struct __FWLEventMouseWheel
{	
	/** The event flag. See enum definitions of <b>FWLEventKeyFlag</b>. */
    UInt32 flag;		
	/** The value of the x-coordinate of the mouse wheel position. */
    Float32 x;		
	/** The value of the y-coordinate of the mouse wheel position. */
    Float32 y;		
	/** The delta value in the x-coordinate direction. */
    Float32 deltaX;    
	/** The delta value in the y-coordinate direction. */
    Float32 deltaY;     
} FWLEventMouseWheel;	

/** 
 * @name FGSPDFFWLEVENT Enumeration Types
 */
/**@{*/
/** 
 *@brief Enumeration for Virtual Key Codes.
 */
enum {
    FWLVKeyCodeBack			= 0x08,	/**  Backspace key. */
    FWLVKeyCodeTab			= 0x09,	/**  Tab key. */
    FWLVKeyCodeClear		= 0x0C,	/**  Clear key. */
    FWLVKeyCodeReturn		= 0x0D,	/**  Enter key. */
    FWLVKeyCodeShift		= 0x10,	/**  Shift key. */
    FWLVKeyCodeControl		= 0x11,	/**  Ctrl key. */
    FWLVKeyCodeMenu			= 0x12,	/**  Menu key. */
    FWLVKeyCodePause		= 0x13,	/**  Pause Break key. */
    FWLVKeyCodeCapital		= 0x14,	/**  Caps Lock key. */
    FWLVKeyCodeKana			= 0x15,	/** Used with IME. */
    FWLVKeyCodeHangul		= 0x15,	/** Used with IME. */
    FWLVKeyCodeJunja		= 0x17,	/** Used with IME. */
    FWLVKeyCodeFinal		= 0x18,	/** Used with IME. */
    FWLVKeyCodeHanja		= 0x19,	/** Used with IME. */
    FWLVKeyCodeKanji		= 0x19,	/** Used with IME. */
    FWLVKeyCodeEscape		= 0x1B,	/**  ESC key. */
    FWLVKeyCodeConvert		= 0x1C,	/** Used with IME. */
    FWLVKeyCodeNonConvert	= 0x1D,	/** Used with IME. */
    FWLVKeyCodeAccept		= 0x1E,	/** Used with IME. */
    FWLVKeyCodeModeChange	= 0x1F,	/** Used with IME. */
    FWLVKeyCodeSpace		= 0x20,	/**  Space key. */
    FWLVKeyCodePrior		= 0x21,	/**  Page Up key. */
    FWLVKeyCodeNext			= 0x22,	/**  Page Down key. */
    FWLVKeyCodeEnd			= 0x23,	/**  End key. */
    FWLVKeyCodeHome			= 0x24,	/**  Home key. */
    FWLVKeyCodeLeft			= 0x25,	/**  left arrow key. */
    FWLVKeyCodeUp			= 0x26,	/**  arrow key. */
    FWLVKeyCodeRight		= 0x27,	/**  right arrow key. */
    FWLVKeyCodeDown			= 0x28,	/**  down arrow key. */
    FWLVKeyCodeSelect		= 0x29,	/**  Select key.*/
    FWLVKeyCodePrint		= 0x2A,	/**  Print key. */
    FWLVKeyCodeExecute		= 0x2B,	/**  Execute key. */
    FWLVKeyCodeSnapshot		= 0x2C,	/**  Print Screen key. */
    FWLVKeyCodeInsert		= 0x2D,	/**  Insert key. */
    FWLVKeyCodeDelete		= 0x2E,	/**  Delete key. */
    FWLVKeyCodeHelp			= 0x2F,	/**  Help key. */
    FWLVKeyCode0 = 0x30,			/**  0 key. */
    FWLVKeyCode1 = 0x31,			/**  1 key. */
    FWLVKeyCode2 = 0x32,			/**  2 key. */
    FWLVKeyCode3 = 0x33,			/**  3 key. */
    FWLVKeyCode4 = 0x34,			/**  4 key. */
    FWLVKeyCode5 = 0x35,			/**  5 key. */
    FWLVKeyCode6 = 0x36,			/**  6 key. */
    FWLVKeyCode7 = 0x37,			/**  7 key. */
    FWLVKeyCode8 = 0x38,			/**  8 key. */
    FWLVKeyCode9 = 0x39,			/**  9 key. */
    FWLVKeyCodeA = 0x41,			/**  A key. */
    FWLVKeyCodeB = 0x42,			/**  B key. */
    FWLVKeyCodeC = 0x43,			/**  C key. */
    FWLVKeyCodeD = 0x44,			/**  D key. */
    FWLVKeyCodeE = 0x45,			/**  E key. */
    FWLVKeyCodeF = 0x46,			/**  F key. */
    FWLVKeyCodeG = 0x47,			/**  G key. */
    FWLVKeyCodeH = 0x48,			/**  H key. */
    FWLVKeyCodeI = 0x49,			/**  I key. */
    FWLVKeyCodeJ = 0x4A,			/**  J key. */
    FWLVKeyCodeK = 0x4B,			/**  K key. */
    FWLVKeyCodeL = 0x4C,			/**  L key. */
    FWLVKeyCodeM = 0x4D,			/**  M key. */
    FWLVKeyCodeN = 0x4E,			/**  N key. */
    FWLVKeyCodeO = 0x4F,			/**  O key. */
    FWLVKeyCodeP = 0x50,			/**  P key. */
    FWLVKeyCodeQ = 0x51,			/**  Q key. */
    FWLVKeyCodeR = 0x52,			/**  R key. */
    FWLVKeyCodeS = 0x53,			/**  S key. */
    FWLVKeyCodeT = 0x54,			/**  T key. */
    FWLVKeyCodeU = 0x55,			/**  U key. */
    FWLVKeyCodeV = 0x56,			/**  V key. */
    FWLVKeyCodeW = 0x57,			/**  W key. */
    FWLVKeyCodeX = 0x58,			/**  X key. */
    FWLVKeyCodeY = 0x59,			/**  Y key. */
    FWLVKeyCodeZ = 0x5A,			/**  Z key. */
    FWLVKeyCodeLWin		= 0x5B,		/**  left windows key(Microsoft keyboard). */
    FWLVKeyCodeCommand	= 0x5B,		/**  command key.*/
    FWLVKeyCodeRWin		= 0x5C,		/**  right windows key(Microsoft keyboard). */
    FWLVKeyCodeApps		= 0x5D,		/**  applications key(Microsoft keyboard). */
    FWLVKeyCodeSleep	= 0x5F,		/**  sleeping key. */
    FWLVKeyCodeNumPad0	= 0x60,		/**  0 key in the numeric keypad. */
    FWLVKeyCodeNumPad1	= 0x61,		/**  1 key in the numeric keypad. */
    FWLVKeyCodeNumPad2	= 0x62,		/**  2 key in the numeric keypad. */
    FWLVKeyCodeNumPad3	= 0x63,		/**  3 key in the numeric keypad. */
    FWLVKeyCodeNumPad4	= 0x64,		/**  4 key in the numeric keypad. */
    FWLVKeyCodeNumPad5	= 0x65,		/**  5 key in the numeric keypad. */
    FWLVKeyCodeNumPad6	= 0x66,		/**  6 key in the numeric keypad. */
    FWLVKeyCodeNumPad7	= 0x67,		/**  7 key in the numeric keypad. */
    FWLVKeyCodeNumPad8	= 0x68,		/**  8 key in the numeric keypad. */
    FWLVKeyCodeNumPad9	= 0x69,		/**  9 key in the numeric keypad. */
    FWLVKeyCodeMultiply = 0x6A,		/**  * key in the numeric keypad. */
    FWLVKeyCodeAdd		= 0x6B,		/**  + key in the numeric keypad. */
    FWLVKeyCodeSeparator = 0x6C,	/**  Enter key in the numeric keypad. */
    FWLVKeyCodeSubtract	= 0x6D,		/**  - key in the numeric keypad. */
    FWLVKeyCodeDecimal	= 0x6E,		/**  . key in the numeric keypad. */
    FWLVKeyCodeDivide	= 0x6F,		/**  / key in the numeric keypad. */
    FWLVKeyCodeF1	= 0x70,			/**  F1 key. */
    FWLVKeyCodeF2	= 0x71,			/**  F2 key. */
    FWLVKeyCodeF3	= 0x72,			/**  F3 key. */
    FWLVKeyCodeF4	= 0x73,			/**  F4 key. */
    FWLVKeyCodeF5	= 0x74,			/**  F5 key. */
    FWLVKeyCodeF6	= 0x75,			/**  F6 key. */
    FWLVKeyCodeF7	= 0x76,			/**  F7 key. */
    FWLVKeyCodeF8	= 0x77,			/**  F8 key. */
    FWLVKeyCodeF9	= 0x78,			/**  F9 key. */
    FWLVKeyCodeF10	= 0x79,			/**  F10 key. */
    FWLVKeyCodeF11	= 0x7A,			/**  F11 key. */
    FWLVKeyCodeF12	= 0x7B,			/**  F12 key. */
    FWLVKeyCodeF13	= 0x7C,			/**  F13 key. */
    FWLVKeyCodeF14	= 0x7D,			/**  F14 key. */
    FWLVKeyCodeF15	= 0x7E,			/**  F15 key. */
    FWLVKeyCodeF16	= 0x7F,			/**  F16 key. */
    FWLVKeyCodeF17	= 0x80,			/**  F17 key. */
    FWLVKeyCodeF18	= 0x81,			/**  F18 key. */
    FWLVKeyCodeF19	= 0x82,			/**  F19 key. */
    FWLVKeyCodeF20	= 0x83,			/**  F20 key. */
    FWLVKeyCodeF21	= 0x84,			/**  F21 key. */
    FWLVKeyCodeF22	= 0x85,			/**  F22 key. */
    FWLVKeyCodeF23	= 0x86,			/**  F23 key. */
    FWLVKeyCodeF24	= 0x87,			/**  F24 key. */
    FWLVKeyCodeNunLock	= 0x90,		/**  Num Lock key. */
    FWLVKeyCodeScroll	= 0x91,		/**  Scroll Lock key. */
    FWLVKeyCodeLShift	= 0xA0,		/**  left Shift key. */	
    FWLVKeyCodeRShift	= 0xA1,		/**  right Shift key. */
    FWLVKeyCodeLControl	= 0xA2,		/**  left Ctrl key. */
    FWLVKeyCodeRControl	= 0xA3,		/**  right Ctrl key. */
    FWLVKeyCodeLMenu	= 0xA4,		/**  left Alt key. */
    FWLVKeyCodeRMenu	= 0xA5,		/**  right Alt key. */
    FWLVKeyCodeBROWSER_Back		= 0xA6,		/** browser back key. */
    FWLVKeyCodeBROWSER_Forward	= 0xA7,		/** browser forward key. */
    FWLVKeyCodeBROWSER_Refresh	= 0xA8,		/** browser refresh key. */
    FWLVKeyCodeBROWSER_Stop		= 0xA9,		/** browser stop key. */
    FWLVKeyCodeBROWSER_Search	= 0xAA,		/** browser search key. */
    FWLVKeyCodeBROWSER_Favorites = 0xAB,	/** browser favorites key. */
    FWLVKeyCodeBROWSER_Home		= 0xAC,		/** browser home key. */
    FWLVKeyCodeVOLUME_Mute		= 0xAD,		/** volume mute key. */
    FWLVKeyCodeVOLUME_Down		= 0xAE,		/** volume down key. */
    FWLVKeyCodeVOLUME_Up		= 0xAF,		/** volume up key. */
    FWLVKeyCodeMEDIA_NEXT_Track	= 0xB0,		/** next track key. */
    FWLVKeyCodeMEDIA_PREV_Track	= 0xB1,		/** previous track key. */
    FWLVKeyCodeMEDIA_Stop		= 0xB2,		/** stop media key. */
    FWLVKeyCodeMEDIA_PLAY_Pause = 0xB3,		/** play/pause media key. */
    FWLVKeyCodeMEDIA_LAUNCH_Mail = 0xB4,	/** [media] launch mail key. */
    FWLVKeyCodeMEDIA_LAUNCH_MEDIA_Select = 0xB5,	/** [media] launch media select key. */
    FWLVKeyCodeMEDIA_LAUNCH_APP1 = 0xB6,	/** [media] launch APP1 key. */
    FWLVKeyCodeMEDIA_LAUNCH_APP2 = 0xB7,	/** [media] launch APP2 key. */
    FWLVKeyCodeOEM_1		= 0xBA,	/** ; : key. */
    FWLVKeyCodeOEM_Plus		= 0xBB,	/** = + key. */
    FWLVKeyCodeOEM_Comma	= 0xBC,	/** , < key. */
    FWLVKeyCodeOEM_Minus	= 0xBD,	/** _ key. */
    FWLVKeyCodeOEM_Period	= 0xBE,	/** . > key. */
    FWLVKeyCodeOEM_2 = 0xBF,		/** / ? key. */
    FWLVKeyCodeOEM_3 = 0xC0,		/** ` ~ key. */
    FWLVKeyCodeOEM_4 = 0xDB,		/** [ { key. */
    FWLVKeyCodeOEM_5 = 0xDC,		/** \ | key. */
    FWLVKeyCodeOEM_6 = 0xDD,		/** ] } key. */
    FWLVKeyCodeOEM_7 = 0xDE,		/** ' " key. */
    FWLVKeyCodeOEM_8 = 0xDF,		/** Used for miscellaneous characters; it can vary by keyboard. */
    FWLVKeyCodeOEM_102	= 0xE2,		/** Either the angle bracket key or the backslash key on the RT 102-key keyboard */
    FWLVKeyCodeProcessKey = 0xE5,	/** IME PROCESS key */
    FWLVKeyCodePacket	= 0xE7,		/** Used to pass Unicode characters as if they were keystrokes. */
    FWLVKeyCodeAttn		= 0xF6,		/** Attn key. */
    FWLVKeyCodeCrsel	= 0xF7,		/** CrSel key. */
    FWLVKeyCodeExsel	= 0xF8,		/** ExSel key. */
    FWLVKeyCodeEreof	= 0xF9,		/** Erase EOF key. */
    FWLVKeyCodePlay		= 0xFA,		/** Play key. */
    FWLVKeyCodeZoom		= 0xFB,		/** Zoom key. */
    FWLVKeyCodeNoName	= 0xFC,		/** The key without a name. */
    FWLVKeyCodePA1		= 0xFD,		/** PA1 key. */
    FWLVKeyCodeOEM_Clear = 0xFE,	/** Clear key */
    FWLVKeyCodeUnknown	= 0,		/** An unkown key. */
};
/** @brief Alias of enumeration for virtual key codes. */
typedef UInt32 FWLVKeyCode;

/** 
 * @brief Enumeration for Key Event Command.
 */
enum {
	/** The key command event: key down. */
    FWLEventKeyCmdKeyDown     = 1,
	/** The key command event: key up. */
    FWLEventKeyCmdKeyUp       = 2,	
	/** The key command event: char. */
    FWLEventKeyCmdChar        = 3,	
};
/** @brief Alias of enumeration for key event command. */
typedef UInt32 FWLEventKeyCmd;
/**@}*/

/** 
 * @brief Structure for Key Event.
 */
typedef struct __FWLEventKey
{
	/** The key command. See enum definitions of <b>FWLEventKeyCmd</b>. */
    UInt32 command;    
	/** The event flag. See enum definitions of <b>FWLEventKeyFlag</b>. */
    UInt32 flag;		
    /** @brief Union for Code */
    union
    {
		/** Virtual key code. See enum definitions of <b>FWLVKeyCode</b>.*/
        UInt32 vkcode;	
		/** Character code. */
        UInt32 charcode;
    } code;
} FWLEventKey;

/** 
 * @brief Structure for Event.
 */
typedef struct __FWLEvent
{
	/** The structure size. */
    UInt32 size; 
	/** The event type. See enum definitions of <b>FWLEventType</b>.*/
    UInt32 type; 
    /** @brief Union for event.*/
    union
    {
		/** A mouse event object. */
        FWLEventMouse       mouse;		
		/** A mouse wheel event object. */
        FWLEventMouseWheel  wheel;  
		/** A key event object. */
        FWLEventKey         key;		
    };
} FWLEvent;
    
#ifdef __cplusplus
};
#endif

#endif // __FGSPDFFWLEVENT__

/**@}*/
